package com.xiao.bargain.mqserver;

import com.xiao.bargain.entity.BarginEntity;
import com.xiao.bargain.entity.NoteMqEntity;
import com.xiao.bargain.feign.AdminFeign;
import com.xiao.bargain.service.BarginService;
import com.xiao.bargain.utils.Myutil;
import com.xiao.group.common.Vo.ReturnMq;
import com.xiao.group.common.Vo.UsersEntity;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "1901anote")
public class NoteMq {
    @Autowired
    AdminFeign adminFeign;

    @Autowired
    BarginService barginService;
    @RabbitHandler
    public void toreturnnsss(NoteMqEntity noteMqEntity){
        UsersEntity info = adminFeign.info(noteMqEntity.getUserId());
        BarginEntity byId = barginService.getById(noteMqEntity.getBargainId());
        String toyzm = Myutil.toyzm(info.getPhone());
        System.out.println("尊敬的"+info.getUsername()+"你好,你参与的"+byId.getGoodsName()+"砍价活动已可以去支付,请在三十分钟内去支付.");
    }
}
